package cn.six.dosomething408.controller;


import cn.six.dosomething408.model.*;
import cn.six.dosomething408.service.jobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/job")
public class jobController {
    @Autowired
    private jobService jobService;

    @RequestMapping("/countEducation")
    public List<education> countEducation(){
        return this.jobService.countEducation();
    }
    @RequestMapping("/countExperience")
    public List<experience> countExperience(){
        return this.jobService.countExperience();
    }

    @RequestMapping("/countSalary")
    public List<salary> countSalary(){
        return this.jobService.countSalary();
    }

    @RequestMapping("/countRequirement")
    public List<requirement> countRequirement(){
        return this.jobService.countRequirement();
    }

    @RequestMapping("/countWorld")
    public List<world> countWorld(){
        return this.jobService.countWorld();
    }

//    @GetMapping("/education")
//    public List<job> countByEducation() {
//        return jobService.countByEducation();
//    }
//
//    @RequestMapping("/findCitySalary")
//    @ResponseBody
//    public String  findCitySalary() throws JSONException {
//        List<CitySalary> citySalaries = jobService.findCitySalary();
//        //将其转为String类型的字符串
//        // 创建一个 Gson 实例，用于将 Java 对象序列化为 JSON
//        Gson gson = new GsonBuilder().setPrettyPrinting().create();
//        // 将 CitySalary 对象列表序列化为 JSON 数组字符串
//        String jsonArrayString = gson.toJson(citySalaries);
//        JSONArray transformer = JsonArrayTransformerUtil.transformer(jsonArrayString);
//        return  transformer.toString();
//    }
}
